/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;

/**
 * <p>Project: jse2303 - ReaderDemo
 * <p>Powered by webrx On 2023-07-24 09:54:08
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class ReaderDemo {
    public static void main(String[] args) {
        //字符流 读取
        try (Reader reader = new FileReader("m.txt")) {
            while (reader.ready()) {
                System.out.print((char) reader.read());
            }
        } catch (Exception e) {

        }

        //字符流 写入
        try (var writer = new FileWriter("m2.txt")) {
            writer.write(97);
            writer.write("\r\n");
            writer.write("hello程序设计\r\n");
        } catch (Exception e) {

        }
    }
}
